import { SAVE_ALL_CHANNELS, SAVE_CHANNELS } from '../constance/home'

const initVal = {
  userChannels: [],
  allChannels: [],
}

const home = (state = initVal, action) => {
  const { type, payload } = action
  switch (type) {
    case SAVE_CHANNELS:
      return {
        ...state,
        userChannels: payload,
      }
    case SAVE_ALL_CHANNELS:
      return {
        ...state,
        allChannels: payload,
      }
    default:
      return state
  }
}

export default home
